package com.keyinong.caizhengting.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.keyinong.caizhengting.R;

import java.util.ArrayList;

/**
 * @author：郑谦
 * @时间：2017-3-20 下午3:47:52
 * @类名：DiaLogAddressAdapter.java
 * @功能: 日期时间适配器
 */

public class DiaLogAddressAdapter extends BaseAdapter {
    Context context;
    ArrayList<String> list;
    int isSelect = -1;

    public DiaLogAddressAdapter(Context context, ArrayList<String> list) {
        super();
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return 0;
    }
//	public void select(int isSelect)
//	{
//		this.isSelect=isSelect;
//	}

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        final ViewHandler handler;
        if (view == null) {
            handler = new ViewHandler();
            view = LayoutInflater.from(context).inflate(
                    R.layout.item_listview_dialogaddress, null);
            handler.tv_dailogAddress = (TextView) view
                    .findViewById(R.id.tv_dailogAddress);
            view.setTag(handler);
        } else {
            handler = (ViewHandler) view.getTag();
        }
        handler.tv_dailogAddress.setText(list.get(position));

//		if(isSelect==position)
//		{
//			handler.tv_dailogAddress.setSelected(true);
//			handler.tv_dailogAddress.setPressed(true);
//			
////			handler.tv_dailogAddress.setBackgroundColor(color.dailog_);
//		}else {
//			handler.tv_dailogAddress.setSelected(false);
//			handler.tv_dailogAddress.setPressed(false);
//		}


        return view;
    }

    class ViewHandler {
        TextView tv_dailogAddress;
    }


}
